package com.dobby.pea.controller;

import com.dobby.pea.common.R;
import com.dobby.pea.utils.KdApiOrderDistinguish;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Dobby
 * @version 1.0
 */

@RestController
@RequestMapping("/api/express")
@Slf4j
public class ExpressController {

    /**
     * 快递查询 目前只支持 申通快递的查询并且一天只能查询500条
     * @param id 传入快递单号
     * @return
     */
    @GetMapping()
    public R<String> ExpressSurvice(@RequestParam String id){
        KdApiOrderDistinguish api = new KdApiOrderDistinguish();
        String result=null;
        try {
            result = api.getOrderTracesByJson(id);
            System.out.print(result);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return R.success(result) ;
    }
}
